﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {

            DriveInfo driveInfo = new DriveInfo("D");
            Console.WriteLine("硬盘的名称：" + driveInfo.Name);
            Console.WriteLine("硬盘类型：" + driveInfo.DriveType);
            Console.WriteLine("文件格式：" + driveInfo.DriveFormat);
            Console.WriteLine("硬盘空间：" + driveInfo.TotalFreeSpace);
            Console.WriteLine("硬盘大小：" + driveInfo.TotalSize);
            
            Console.WriteLine();
            DriveInfo[] text = DriveInfo.GetDrives();

            bool flag = Directory.Exists("D:\\sen");
            if (flag)
            {
                Directory.Delete("D:\\Sen", true);
                Console.WriteLine("已删除");
            }
            else
            {
                Directory.CreateDirectory("D:\\sen");
            }

            FileInfo fileInfo = new FileInfo("D:\\sen\\text.txt");
            fileInfo.Create().Close();
            string ab = @"D:\\sen\\text.txt";
            StreamWriter sw = new StreamWriter(ab);
                sw.WriteLine("新二同志");
                sw.WriteLine("老八同志");
                sw.WriteLine("快乐生活一点通");
                sw.Flush();
                sw.Close();
            
          
        }
    }
}
